<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>
<script>
    oMyForm.append("username", "Groucho");
    oMyForm.append("accountnum", 123456); // 数字123456被立即转换成字符串"123456"

    // fileInputElement中已经包含了用户所选择的文件
    oMyForm.append("userfile", fileInputElement.files[0]);var oReq = new XMLHttpRequest();
    oReq.open("POST", "http://foo.com/submitform.php");
//    设置请求头
    oReq.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    oReq.send(oMyForm);


    //========================================
/*
    var newFormData = new FormData(someFormElement);
    var formElement = document.getElementById("myFormElement");
    var oReq = new XMLHttpRequest();
    oReq.open("POST", "submitform.php");
    oReq.send(new FormData(formElement));
    */
</script>